
case class pro(name:String,age:Int)




object HelloScala {
  def main(args: Array[String]): Unit = {

    // 模式匹配 类似于 java
    def matchTest( x:Any) = {

      val pro1 = new pro("zhangsan",18)
      val pro2 = new pro("lisi",22)

      val proList = List(pro1,pro2)

      proList.foreach(x=> {
        x match {
          case pro("zhangsan", 18) => println("i am zhangsan")
          case _ => println("no match") //_表示默认值
        }


      })
    }
    matchTest("zhangsan",18)


  }

}
